<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="include :: header('修改角色')" />
	<th:block th:include="include :: ztree-css" />
</head>
<body class="white-bg">
	<div class="wrapper wrapper-content animated fadeInRight ibox-content">
		<form class="form-horizontal m" id="form-role-edit" th:object="${customer}">
			<input id="id" name="id" type="hidden" th:field="*{id}"/>
			<div class="form-group">
				<label class="col-sm-3 control-label is-required">客户名称：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="customerName" id="customerName" th:field="*{customerName}" required>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label is-required">客户地址：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="customerAddress" id="customerAddress" th:field="*{customerAddress}" required>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label is-required">客户电话：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="customerPhone" id="customerPhone" th:field="*{customerPhone}" required>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label is-required">客户电话：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="customerLinkman" id="customerLinkman" th:field="*{customerLinkman}" required>
				</div>
			</div>

		</form>
	</div>
	<th:block th:include="include :: footer" />
	<th:block th:include="include :: ztree-js" />
	<script type="text/javascript">

		function edit() {

			var id = $("input[name='id']").val();
			var customerName = $("input[name='customerName']").val();
			var customerAddress = $("input[name='customerAddress']").val();
			var customerPhone = $("input[name='customerPhone']").val();
			var customerLinkman = $("input[name='customerLinkman']").val();
			$.ajax({
				cache : true,
				type : "POST",
				url : ctx + "customer/edit",
				data : {
					"id": id,
					"customerName": customerName,
					"customerAddress": customerAddress,
					"customerPhone": customerPhone,
					"customerLinkman":customerLinkman
				},
				async : false,
				error : function(request) {
					$.modal.alertError("系统错误");
				},
				success : function(data) {
					$.operate.successCallback(data);
				}
			});
		}
		
		function submitHandler() {
	        if ($.validate.form()) {
	        	edit();
	        }
	    }
	</script>
</body>
</html>
